import Request from '@/libs/request'
import qs from 'qs'

// /**查询合格标准 ---多设备 */
// export const uSelectMyAllDevStandRange = (data: { devId: string | number }) =>
//   Request.get<Standard.StandardData[]>('/platFormSubUser/select/devStandRange', data)

// /**用户修改合格标准 */
// export const uEditDevStandRange = (data: { devSRId: number; standRange: string }) =>
//   Request.get<null>('/user/uEditDevStandRange', data)

// /**用户开启单个参数的合格标准 */
// export const openDevStandRange = (data: { devSRId: number }) =>
//   Request.get<null>('/user/openDevStandRange', data)

// /**用户开启单个参数的合格标准 */
// export const closeDevStandRange = (data: { devSRId: number }) =>
//   Request.get<null>('/user/closeDevStandRange', data)


// 使用枚举包含所有的path
enum Api {
  // 查询设备下的所有参数的标准设置
  selectStandRange = '/platFormSubUser/select/devStandRange',
  // 修改标准
  editStandRange = '/platFormSubUser/edit/devStandRange',
  // 清除标准
  clearStandRange = '/platFormSubUser/edit/clearDevStandRange',
  // 开启单个参数的合格标准开关
  openStandRange = '/platFormSubUser/open/devStandRange',
  // 关闭单个参数的合格标准开关
  closeStandRange = '/platFormSubUser/close/devStandRange',
}


/* 接口 ------------------------------------------------------------------- */

// 查询设备下的所有参数的标准设置的Api
export const selectStandRangeApi = (data: { devId: number | string }) => {
  return Request.post(Api.selectStandRange, qs.stringify(data))
}

// 修改标准的Api
export const editStandRangeApi = (data: { devSRId: number | string, standRange: string }) => {
  return Request.post(Api.editStandRange, qs.stringify(data))
}


// 清除标准的Api
export const clearStandRangeApi = (data: { devSRId: number | string }) => {
  return Request.post(Api.clearStandRange, qs.stringify(data))
}

// 开启单个参数的合格标准开关的Api
export const openStandRangeApi = (data: { devSRId: number | string }) => {
  return Request.post(Api.openStandRange, qs.stringify(data))
}

// 关闭单个参数的合格标准开关的Api
export const closeStandRangeApi = (data: { devSRId: number | string }) => {
  return Request.post(Api.closeStandRange, qs.stringify(data))
}


// 图片测试请求 --- 用于测试有没有该图片
export const isImageApi = (paramName: string) => {
  return Request.get(`https://d.lohand.com:1112/images/ConstantBlueCloud/params/${ paramName }.png`)
}